/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package grex.Data;

import grex.Nodes.Node;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Hashtable;

/**gene
 *
 * @author RIK
 */
public class PredictionContainer extends Hashtable<double[],Prediction> implements Serializable {
    
    public PredictionContainer(int capacity){
        super(capacity);
    }
    public PredictionContainer clone(){
        PredictionContainer pc = new PredictionContainer(this.size());
        Enumeration<Prediction> items = elements();
        while(items.hasMoreElements()){
            Prediction  p  = items.nextElement().getCopy();
            pc.put(p.getInstance(), p);
        }
        return pc;
    }
    
    public PredictionContainer shallowClone(){
        return (PredictionContainer) super.clone();
    }
    
    public ArrayList<Node> getPredictionLeafs(){
        ArrayList<Node> leafs = new ArrayList<Node>();
        for(Prediction p:values()){
            leafs.add(p.getGene());
        }
        
        return leafs;
    }
    
}
